package com.tankgame;

import javax.swing.*;
import java.awt.*;

/**
 * @author yicixingchen
 * @version 1.0
 * Create by 2022/10/24 17:36
 */

public class Tortoise extends JPanel {
    public Tortoise(){
        System.out.println("实例");
    }

    @Override
    public void paint(Graphics g) {
        super.paint(g);
        System.out.println("g方法被调用了");
//        g.fillRect(0, 0,1000,750);
        g.setColor(Color.black);
        g.drawLine(500,250,550,310);
        g.drawLine(600,250,550,310);
        g.drawLine(500,370,550,310);
        g.drawLine(600,370,550,310);
        g.setColor(Color.red);
        g.fillOval(500,250,100,120);
        g.setColor(Color.green);
        g.fillOval(522,200,50,50);

    }

}
class drawTortoise extends JFrame{
    private Tortoise myTortoise = null;
    public static void main(String[] args) {
        new drawTortoise();
        System.out.println("退出程序");
    }

    public drawTortoise() {
        myTortoise = new Tortoise();
        this.add(myTortoise);
        this.setSize(1000, 750);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);
    }
}

